home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / goto.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  2KB  |  77 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /* goto.c */
  22.  
  23. #include "externs.h"
  24.  
  25.  
  26. void AVL_DO_GOTO(int n)
  27. {
  28.     AVL_EDIT_WINDOW_PTR w;
  29.     AVL_LINE_PTR temp;
  30.     char inp[100];
  31.     w = &avl_windows[avl_window];
  32.     temp = w -> head -> next;
  33.     while ( temp -> line_no != n)  {
  34.         temp = temp -> next;
  35.         if (temp == w -> head)  {
  36.             sprintf(inp,"Program ERROR AVL_GOTO (%d) ...", n);
  37.             AVL_ERROR(inp);
  38.             exit(1);
  39.             }
  40.         }
  41.     w -> current_line = temp;
  42.     w -> txt_col = 0;
  43.     w -> scr_col = 1;
  44.     w -> scr_row = 1;
  45.     _settextposition(1,1);
  46.     AVL_UPDATE_SCREEN();
  47. }
  48.  
  49. void AVL_GOTO()
  50. {
  51.     AVL_WIN_PTR m;
  52.     AVL_EDIT_WINDOW_PTR w;
  53.     AVL_LINE_PTR temp;
  54.     char inp[100];
  55.     int n;
  56.     w = &avl_windows[avl_window];
  57.     inp[0] = '\0';
  58.     m = AVL_MAKE_WINDOW(" Go to line number: ",23,1,25,30
  59.         ,avl_pro_bk_color,avl_pro_color);
  60.     AVL_PROMPT(1,2,inp, 10);
  61.     if (inp[0] == '\0') {
  62.         AVL_DEL_WINDOW(m);
  63.         return;
  64.         }
  65.     n = atoi(inp);
  66.     temp = w -> head -> next;
  67.     if ((n < (w -> head -> next -> line_no - 1)) ||
  68.         (n > (w -> head -> previous -> line_no - 1)))  {
  69.         AVL_ERROR("Invalid line number.");
  70.         AVL_DEL_WINDOW(m);
  71.         return;
  72.         }
  73.     ++n;
  74.     AVL_DEL_WINDOW(m);
  75.     AVL_DO_GOTO(n);
  76. }
  77.